package com.io;

import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class HelloClient {
    public static void main(String[] args) throws Exception { 		// 沐言科技：www.yootk.com
        // 设置服务器的连接地址（localhost表示本机）以及端口号
        Socket client = new Socket("localhost", 9999);
        Scanner scanner = new Scanner(client.getInputStream());		// 接收服务端输出
        if (scanner.hasNext()) { // 接收到数据
            System.out.println("【HelloClient】" + scanner.next());	// 内容打印
        }
        client.shutdownInput();			// 等待输入完成
        client.close();
    }

}
